package com.wyzz.hr.util.pager;

import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.UIBean;

public class PagerComp extends UIBean {

	public PagerComp(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}

	protected String getDefaultTemplate() {
		return "pager";
	}

	protected void evaluateExtraParams() {
		super.evaluateExtraParams();
		if (pageNo != null)
			addParameter("pageNo", findValue(pageNo));
		if (totalPages != null)
			addParameter("totalPages", findValue(totalPages));
		if (totalRows != null)
			addParameter("totalRows", findValue(totalRows));
		if (start != null)
			addParameter("start", findValue(start));
		if (end != null)
			addParameter("end", findValue(end));
		if (formId != null)
			addParameter("formId", findString(formId));
		if (styleClass != null)
			addParameter("styleClass", findValue(styleClass));
	}

	public String getPageNo() {
		return pageNo;
	}

	public void setPageNo(String pageNo) {
		this.pageNo = pageNo;
	}

	public HttpServletRequest getRequest() {
		return request;
	}

	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}

	public String getStyleClass() {
		return styleClass;
	}

	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}

	public String getTotalPages() {
		return totalPages;
	}

	public void setTotalPages(String totalPages) {
		this.totalPages = totalPages;
	}

	public String getTotalRows() {
		return totalRows;
	}

	public void setTotalRows(String totalRows) {
		this.totalRows = totalRows;
	}

	public String getEnd() {
		return end;
	}

	public void setEnd(String end) {
		this.end = end;
	}

	public String getStart() {
		return start;
	}

	public void setStart(String start) {
		this.start = start;
	}

	public String getFormId() {
		return formId;
	}

	public void setFormId(String formId) {
		this.formId = formId;
	}

	public final String TEMPLATE = "pager";
	private String pageNo;
	private String totalPages;
	private String totalRows;
	private String start;
	private String end;
	private String formId;
	private String styleClass;
}
